package com.controller.setting;



import com.comm.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


//查询所有科室信息
@RequestMapping("/office")
@RestController
@Api(value = "科室管理数据test",tags = "科室管理数据信息接口API")
public class SysOfficeController {

    //科室管理按钮
    @RequestMapping(value = "/findOfficeList",method = RequestMethod.GET)
    @ApiOperation(value = "显示所有科室信息接口",notes = "查询所有科室信息",httpMethod = "get", response = R.class)
    public R findOfficeList(){

        R r = new R();
        r.setCode(200);
        r.setMsg("查询成功");
        String data = "[{\n" +
                "  \"id\":1,\n" +
                "  \"officeName\":\"腔肠科\",\n" +
                "  \"科室编号\":\"2023021500000001\"},\n" +
                "{\n" +
                "  \"id\":2,\n" +
                "  \"officeName\":\"神经外科\",\n" +
                "  \"科室编号\":\"2022091200000002\"},\n" +
                "{\n" +
                "  \"id\":3,\n" +
                "  \"officeName\":\"神经科\",\n" +
                "  \"科室编号\":\"2022091200000003\"},\n" +
                "{\n" +
                "  \"id\":4,\n" +
                "  \"officeName\":\"骨科\",\n" +
                "  \"科室编号\":\"2023021500000004\"}\n" +
                "]";
        r.setData(data);
        return r;
    }

    //查询按钮
    @RequestMapping(value = "/findOfficeByName",method = RequestMethod.GET)
    @ApiOperation(value = "条件查询科室信息接口",notes = "根据科室名称查询科室信息",httpMethod = "get", response = R.class)
    @ApiImplicitParam(name = "office_name",value = "科室名称",required = true,dataType = "String",paramType = "query")
    public R findOfficeByName(@RequestParam(name = "office_name") String office_name){

        R r = new R();
        r.setCode(200);
        r.setMsg("查询成功");
        String data = "[{\n" +
                "  \"id\":1,\n" +
                "  \"officeName\":\"腔肠科\",\n" +
                "  \"科室编号\":\"2023021500000001\"}]";
        r.setData(data);
        return r;

    }

    //新增按钮
    @RequestMapping(value = "/addOfficeByName  ",method = RequestMethod.POST)
    @ApiOperation(value = "添加科室接口",notes = "新增一个科室",httpMethod = "post", response = R.class)
    @ApiImplicitParam(name = "office_name",value = "科室名称",required = true,dataType = "String",paramType = "query")
    public R addOfficeByName(@RequestParam(name = "office_name")String office_name){

        R r = new R();
        r.setCode(200);
        r.setMsg("添加成功");
        return r;
    }


    //编辑按钮
    @RequestMapping(value = "/updateOfficeById",method = RequestMethod.POST)
    @ApiOperation(value = "编辑科室接口",notes = "根据科室id修改科室的信息",httpMethod = "post", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id",value = "科室Id",paramType = "query",dataType = "int",required = true),
            @ApiImplicitParam(name = "office_name",value = "科室名称",paramType = "query",dataType = "String",required = true)
    })
    public R updateOfficeById(@RequestParam(name = "id")Integer id,
                          @RequestParam(name = "office_name")String office_name){

        R r = new R();
        r.setCode(200);
        r.setMsg("修改成功");
        return r;

    }

    //删除按钮
    @RequestMapping(value = "/delOfficeById  ",method = RequestMethod.POST)
    @ApiOperation(value = "删除科室接口",notes = "根据科室Id删除科室信息",httpMethod = "post", response = R.class)
    @ApiImplicitParam(name = "id",value = "科室Id",required = true,dataType = "int",paramType = "query")
    public R delOfficeById(@RequestParam(name = "id")Integer id){

        R r = new R();
        r.setCode(200);
        r.setMsg("删除成功");
        return r;

    }

}
